<%@page contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<div class="pageContent">
<form:form  action="${ctx}/role/savepermissiontree/${role.id}?navtabid=roleNav" method="post"   onsubmit="return validateCallback(this, dialogAjaxDone);">
    <input type="hidden" value="" name="permissionlist"    id="permissionlist">
    <div  layoutH="60" id="t2">
	  <ul class="tree treeFolder treeCheck expand" oncheck="treeclick">
            <c:forEach var="functionList" items="${map}">
            <li><a >${functionList.key} </a>
                <ul>
                <c:forEach var="function" items="${functionList.value}">
                    <li><a tname="id" tvalue="${function.id}"
                          ${'true' eq function.checked ? 'checked="true"' : ''}
                        >${function.name}</a></li>
                </c:forEach>
                </ul>
            </li>
            </c:forEach>
        </ul>
     </div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存角色权限</button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close">关闭</button></div></div></li>
			</ul>
	</div>
</form:form>
</div>
<script type="text/javascript">
    function treeclick()  {
        var oidStr=""; //定义一个字符串用来装值的集合
        $("#t2 input:checked").each(function(i,a){
            oidStr +=a.value+',';  //拼接字符串
        });
        var reg=/,$/gi;
        oidStr=oidStr.replace(reg,"");
        $("#permissionlist").val(oidStr) ;
    }
</script>
